package newspaperSystem;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.util.Date;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Leo
 */
public class updateForm extends javax.swing.JFrame implements ActionListener {

    /**
     * Creates new form updateForm
     */
    
    private ButtonGroup bg = new ButtonGroup();
   
    
    public updateForm() {
        initComponents();
        
        jRadioButton1.addActionListener(this);
        jRadioButton2.addActionListener(this);
        jRadioButton3.addActionListener(this);
        jRadioButton4.addActionListener(this);
        jRadioButton5.addActionListener(this);
        jRadioButton6.addActionListener(this);
        jRadioButton7.addActionListener(this);
        
        bg.add(jRadioButton1);
        bg.add(jRadioButton2);
        bg.add(jRadioButton3);
        bg.add(jRadioButton4);
        bg.add(jRadioButton5);
        bg.add(jRadioButton6);
        bg.add(jRadioButton7);
        
        jButton1.addActionListener(this);
        jButton2.addActionListener(this);
        jButton3.addActionListener(this);
        jButton4.addActionListener(this);
        jButton5.addActionListener(this);
        jButton6.addActionListener(this);
        jButton7.addActionListener(this);
        jButton8.addActionListener(this);
        jButton9.addActionListener(this);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jRadioButton3 = new javax.swing.JRadioButton();
        jRadioButton4 = new javax.swing.JRadioButton();
        jRadioButton5 = new javax.swing.JRadioButton();
        jRadioButton6 = new javax.swing.JRadioButton();
        jRadioButton7 = new javax.swing.JRadioButton();
        jButton2 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jTextField5 = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTextField6 = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTextField7 = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jTextField8 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTextField9 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jTextField10 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jTextField11 = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jTextField12 = new javax.swing.JTextField();
        jToolBar2 = new javax.swing.JToolBar();
        jButton1 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton9 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
        jLabel1.setText("Update data");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        jRadioButton1.setText("Carriers");
        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton1ActionPerformed(evt);
            }
        });

        jRadioButton2.setText("Customers");

        jRadioButton3.setText("Product");
        jRadioButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton3ActionPerformed(evt);
            }
        });

        jRadioButton4.setText("Bill");
        jRadioButton4.setActionCommand("billRadio");

        jRadioButton5.setText("Suppliers");

        jRadioButton6.setText("Subscription");

        jRadioButton7.setText("Routes");

        jButton2.setText("Back");

        jLabel2.setText("Enter Id of the field to update:");

        jButton3.setText("Search");
        jButton3.setActionCommand("srchUpBtn");

        jLabel3.setText("Subscription Id:");

        jLabel4.setText("Name:");

        jLabel5.setText("Surname:");

        jLabel6.setText("Phone#:");

        jLabel7.setText("Description:");

        jLabel8.setText("Address 1:");

        jLabel9.setText("Surbab:");

        jLabel10.setText("Type:");

        jLabel11.setText("Date:");

        jLabel12.setText("Amount:");

        jLabel13.setText("Customer Id:");

        jTextField12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField12ActionPerformed(evt);
            }
        });

        jToolBar2.setRollover(true);

        jButton1.setText("Carriers");
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jButton1);
        jButton1.getAccessibleContext().setAccessibleName("UpdateBtn");

        jButton5.setText("Customers");
        jButton5.setFocusable(false);
        jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jButton5);

        jButton4.setText("Product");
        jButton4.setFocusable(false);
        jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jButton4);

        jButton9.setText("Subscription");
        jButton9.setFocusable(false);
        jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jButton9);

        jButton7.setText("Bill");
        jButton7.setFocusable(false);
        jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jButton7);

        jButton8.setText("Routes");
        jButton8.setFocusable(false);
        jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jButton8);

        jButton6.setText("Suppliers");
        jButton6.setFocusable(false);
        jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jButton6);

        jLabel14.setFont(new java.awt.Font("Arial Black", 2, 12)); // NOI18N
        jLabel14.setText("Click 1 table button to update record");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton2)
                            .addComponent(jRadioButton3)
                            .addComponent(jRadioButton4))
                        .addGap(50, 50, 50)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jRadioButton6)
                            .addComponent(jRadioButton1)))
                    .addComponent(jRadioButton5)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextField1)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel4))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTextField3)
                                    .addComponent(jTextField12)
                                    .addComponent(jTextField5)
                                    .addComponent(jTextField6)
                                    .addComponent(jTextField4)
                                    .addComponent(jTextField2, javax.swing.GroupLayout.Alignment.TRAILING))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11)
                            .addComponent(jLabel12))))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 284, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(122, 122, 122))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextField8, javax.swing.GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)
                            .addComponent(jTextField9)
                            .addComponent(jTextField10)
                            .addComponent(jTextField11)
                            .addComponent(jTextField7)
                            .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 471, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(77, 77, 77))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(125, 125, 125)
                .addComponent(jButton2)
                .addGap(130, 130, 130))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(44, 44, 44)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jRadioButton2)
                            .addComponent(jRadioButton1))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jRadioButton6)
                            .addComponent(jRadioButton3))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jRadioButton4)
                            .addComponent(jRadioButton7))
                        .addGap(18, 18, 18)
                        .addComponent(jRadioButton5)
                        .addGap(39, 39, 39)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8)
                            .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13)
                            .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9)
                            .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(10, 10, 10)
                                        .addComponent(jLabel10))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel4))))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel5)
                                    .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel11)
                                    .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(21, 21, 21)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6)
                            .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12)
                            .addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 369, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton2))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addGap(18, 18, 18)
                        .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel1.getAccessibleContext().setAccessibleName("updateLbl");
        jRadioButton1.getAccessibleContext().setAccessibleName("carrierRadio");
        jRadioButton2.getAccessibleContext().setAccessibleName("custRadio");
        jRadioButton3.getAccessibleContext().setAccessibleName("prodRadio");
        jRadioButton4.getAccessibleContext().setAccessibleName("billRadio");
        jRadioButton5.getAccessibleContext().setAccessibleName("suppRadio");
        jRadioButton6.getAccessibleContext().setAccessibleName("suppRadio");
        jRadioButton7.getAccessibleContext().setAccessibleName("routesRadio");
        jButton2.getAccessibleContext().setAccessibleName("backBtn");
        jTextField1.getAccessibleContext().setAccessibleName("srchUpField");
        jButton3.getAccessibleContext().setAccessibleName("srchUpBtn");
        jTextField2.getAccessibleContext().setAccessibleName("subscrIdTxt");
        jLabel4.getAccessibleContext().setAccessibleName("nameLbl");
        jTextField3.getAccessibleContext().setAccessibleName("nameTxt");
        jTextField4.getAccessibleContext().setAccessibleName("snameTxt");
        jTextField5.getAccessibleContext().setAccessibleName("phoneTxt");
        jTextField6.getAccessibleContext().setAccessibleName("descrTxt");
        jTextField7.getAccessibleContext().setAccessibleName("addrTxt");
        jLabel9.getAccessibleContext().setAccessibleName("subLbl");
        jTextField8.getAccessibleContext().setAccessibleName("subTxt");
        jLabel10.getAccessibleContext().setAccessibleName("typeLbl");
        jTextField9.getAccessibleContext().setAccessibleName("typeTxt");
        jTextField10.getAccessibleContext().setAccessibleName("dateTxt");
        jTextField11.getAccessibleContext().setAccessibleName("amountTxt");

        pack();
    }// </editor-fold>//GEN-END:initComponents
    public void getConnections(){
    
                
    
    }
    private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButton1ActionPerformed

    private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed
        // TODO add your handling code here
        
         
    }//GEN-LAST:event_jRadioButton3ActionPerformed

    private void jTextField12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField12ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField12ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(updateForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(updateForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(updateForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(updateForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new updateForm().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JRadioButton jRadioButton4;
    private javax.swing.JRadioButton jRadioButton5;
    private javax.swing.JRadioButton jRadioButton6;
    private javax.swing.JRadioButton jRadioButton7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField10;
    private javax.swing.JTextField jTextField11;
    private javax.swing.JTextField jTextField12;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JTextField jTextField7;
    private javax.swing.JTextField jTextField8;
    private javax.swing.JTextField jTextField9;
    private javax.swing.JToolBar jToolBar2;
    // End of variables declaration//GEN-END:variables

    @Override
    public void actionPerformed(ActionEvent e) {
        
                Locale loc = Locale.getDefault();
		ResourceBundle bundle = ResourceBundle.getBundle("database",loc);
                String url = bundle.getString("URL");
                String user = bundle.getString("username");
         	String pw = bundle.getString("password");
                String driver = bundle.getString("Driver");  
                Connection conn = null;
                Statement stmt = null;
                
                //PreparedStatement pstmnt;
                
                ResultSet resultSet =null;
       
            try{
            
                 Class.forName(driver);
                 System.out.println("Driver loaded succesfully!!!");
              
            } catch(ClassNotFoundException classNotFound){
                
                System.out.println("OOps class not found:"+classNotFound);
            }
               
            try{
                   
                   conn = DriverManager.getConnection(url, user, pw); 
                  
                   System.out.println("Connection successful");
                   stmt = conn.createStatement();
                   
            try{
                
               if(e.getSource()==jRadioButton3){
                   
                String query3 = "Select* from Product";
               
                resultSet = stmt.executeQuery(query3);
                                
            
            if(resultSet!=null)
                jTextArea1.setText("Product Id\tSubscription Id\tProduct descr\tProduct Price\n");
                jTextArea1.append("=============================================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t"+resultSet.getString(3)+"\t"+resultSet.getString(4)+"\n");
                }
        }
        if(e.getSource()==jButton2){
           this.dispose();
        }
        else if(e.getSource()==jRadioButton1){
        
            String query = "Select* from Carriers";
         
                resultSet = stmt.executeQuery(query);
                  
              if(resultSet!=null)
               jTextArea1.setText("Carrier Id\tName\tSurname\tPhone Number\tAddress\tSurbab\n");
               jTextArea1.append("====================================================================\n");
               
                while(resultSet.next()){
                            
               jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t"+resultSet.getString(3)+"\t"+resultSet.getString(4)+"\t"+resultSet.getString(5)+"\t"+resultSet.getString(6)+"\n");
              }
        
        }
        if(e.getSource()==jRadioButton2){
        
        String query2 = "Select* from Customer";
           resultSet = stmt.executeQuery(query2);
        
           if(resultSet!=null)
               jTextArea1.setText("Customer Id\tName\tSurname\tPhone Number\tAddress\tSurbab\n");
               jTextArea1.append("========================================================================\n");
           
            while(resultSet.next()){
                     
           jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t  "+resultSet.getString(3)+"\t"+resultSet.getString(4)+"\t"+resultSet.getString(5)+"\t"+resultSet.getString(6)+"\n");
       }
        }
        else if(e.getSource()==jRadioButton6){
        
            String query4 = "Select* from Subscription";
            resultSet = stmt.executeQuery(query4);
                     
            if(resultSet!=null)
                jTextArea1.setText("Subscription Id\tCustomer Id\tType\tDescription\n");
                jTextArea1.append("=========================================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t"+resultSet.getString(3)+"\t"+resultSet.getString(4)+"\n");
                }
       
        }
        else if(e.getSource()==jRadioButton7){
        
            String query5 = "Select* from Routes";
            resultSet = stmt.executeQuery(query5);
                     
            if(resultSet!=null)
                jTextArea1.setText("Route Number\tRoute Name\tRoute description\tRoute Address\n");
                jTextArea1.append("===============================================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t"+resultSet.getString(3)+"\t\t"+resultSet.getString(4)+"\n");
                }
         
        }
        else if(e.getSource()==jRadioButton4){
        
             String dispQuery = "Select* from Bill";
             resultSet = stmt.executeQuery(dispQuery);
                     
            if(resultSet!=null)
             jTextArea1.setText("Customer Id\tCustomer Name\tSubscription Type\tAmount\n");
             jTextArea1.append("=====================================================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t\t"+resultSet.getString(3)+"\t\t"+resultSet.getString(4)+"\n");
                }
        
        }
        else if(e.getSource()==jRadioButton5){
        
             String query7 = "Select* from Suppliers";
             resultSet = stmt.executeQuery(query7);
                     
            if(resultSet!=null)
                jTextArea1.setText("Supplier Name \t\tDate\n");
                jTextArea1.append("========================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t\t"+resultSet.getString(2)+"\n");
                    
                }
        }
        if(e.getSource()==jButton3){    
           String sql  = "Select * from Carriers";
           String sql2 = "Select * from Customer";
           String sql3 = "Select * from Product";
           String sql4 = "Select * from Bill";
           String sql5 = "Select * from Routes";
           String sql6 = "Select * from Suppliers";
           String sql7 = "Select * from Subscription";
           
           String updSearch = jTextField1.getText();
           ResultSet rs;
           ResultSet rs2;
           ResultSet rs3;
           ResultSet rs4;
           ResultSet rs5;
           ResultSet rs6;
           ResultSet rs7;
           
           rs = stmt.executeQuery(sql);
           while(rs.next()){
            if(updSearch.equalsIgnoreCase(rs.getString(1))){
               
                jTextField3.setText(rs.getString(2));
                jTextField4.setText(rs.getString(3));
                jTextField5.setText(rs.getString(4));
                jTextField7.setText(rs.getString(5));
                jTextField8.setText(rs.getString(6));
            }
         }
           rs2 = stmt.executeQuery(sql2);
           while(rs2.next()){
            if(updSearch.equalsIgnoreCase(rs2.getString(1))){
               
                jTextField3.setText(rs2.getString(2));
                jTextField4.setText(rs2.getString(3));
                jTextField5.setText(rs2.getString(4));
                jTextField7.setText(rs2.getString(5));
                jTextField8.setText(rs2.getString(6));
                
                
            }
        }
           rs3 = stmt.executeQuery(sql3);
           while(rs3.next()){
            if(updSearch.equalsIgnoreCase(rs3.getString(1))){
               
                jTextField2.setText(rs3.getString(2));
                jTextField6.setText(rs3.getString(3));
                jTextField11.setText(rs3.getString(4));
              
            }
           }
           rs4 = stmt.executeQuery(sql4);
           while(rs4.next()){
            if(updSearch.equalsIgnoreCase(rs4.getString(1))){
               
                jTextField3.setText(rs4.getString(2));
                jTextField9.setText(rs4.getString(3));
                jTextField11.setText(rs4.getString(4));
          
            }
         
           }
           
           rs5 = stmt.executeQuery(sql5);
           while(rs5.next()){
            if(updSearch.equalsIgnoreCase(rs5.getString(1))){
               
                jTextField3.setText(rs5.getString(2));
                jTextField6.setText(rs5.getString(3));
                jTextField7.setText(rs5.getString(4));
                jTextField8.setText(rs5.getString(5));
                
            }
           }
           
           rs6 = stmt.executeQuery(sql6);
           while(rs6.next()){
            if(updSearch.equalsIgnoreCase(rs6.getString(1))){
               
                jTextField3.setText(rs6.getString(1));
                jTextField10.setText(rs6.getString(2));
       
            }
           }
          rs7 = stmt.executeQuery(sql7);
           while(rs7.next()){
            if(updSearch.equalsIgnoreCase(rs7.getString(1))){
               
                jTextField12.setText(rs7.getString(2));
                jTextField9.setText(rs7.getString(3));
                jTextField6.setText(rs7.getString(4));
                
            }
           } 
        }
        if(e.getSource()==jButton1){
        
                String field1 = jTextField1.getText();
               
         
                String field3=jTextField3.getText();
                String field4=jTextField4.getText();
                String field5=jTextField5.getText();
                String field7= jTextField7.getText();
                String field8= jTextField8.getText();
              
                    
                String sqlUpdate = "Update Carriers set Name='"+(field3)+"',Surname='"+(field4)
                        +"',Phone_Num='"+(field5)+"',Address='"+(field7)+"',Surbab='"+(field8)+"' Where Carrier_Id='"+(field1)+"'";
                      
                      stmt.executeUpdate(sqlUpdate);
          
                JOptionPane.showMessageDialog(null,"Table Carriers Updated");
                    jTextField3.setText("");
                    jTextField4.setText("");
                    jTextField5.setText("");
                    jTextField7.setText("");
                    jTextField8.setText("");
                           
        }
          if(e.getSource()==jButton5){
        
                String field1 = jTextField1.getText();
               
         
                String field3=jTextField3.getText();
                String field4=jTextField4.getText();
                String field5=jTextField5.getText();
                String field7= jTextField7.getText();
                String field8= jTextField8.getText();
              
                    
                String sqlUpdate = "Update Customer set Cust_Name='"+(field3)+"',Cust_Surname='"+(field4)
                        +"',Phone_Num='"+(field5)+"',Cust_Address='"+(field7)+"',Surbab='"+(field8)+"' Where Cust_Id='"+(field1)+"'";
                      
                      stmt.executeUpdate(sqlUpdate);
          
                JOptionPane.showMessageDialog(null,"Table Customers Updated");
                    jTextField3.setText("");
                    jTextField4.setText("");
                    jTextField5.setText("");
                    jTextField7.setText("");
                    jTextField8.setText("");
                           
        }
          if(e.getSource()==jButton4){
        
                String field1 = jTextField1.getText();
               
         
                String field3=jTextField6.getText();
                String field4=jTextField11.getText();
                
                    
                String sqlUpdate = "Update Product set Prod_Descr='"+(field3)+"',Prod_Price='"+(field4)+"' Where Prod_Id='"+(field1)+"'";
                      
                      stmt.executeUpdate(sqlUpdate);
          
                JOptionPane.showMessageDialog(null,"Table Product Updated");
                    jTextField6.setText("");
                    jTextField11.setText("");
                    
                           
        } 
          if(e.getSource()==jButton9){
        
                String field1 = jTextField1.getText();
               
         
                String field3=jTextField9.getText();
                String field4=jTextField6.getText();
                
                    
                String sqlUpdate = "Update Subscription set Type='"+(field3)+"',Descr='"+(field4)+"' Where Subscr_Id='"+(field1)+"'";
                      
                      stmt.executeUpdate(sqlUpdate);
          
                JOptionPane.showMessageDialog(null,"Table Subscription Updated");
                    jTextField9.setText("");
                    jTextField6.setText("");
                   
                           
        } 
          if(e.getSource()==jButton7){
        
                String field1 = jTextField1.getText();
               
         
                String field3=jTextField3.getText();
                String field4=jTextField9.getText();
                String field5 =jTextField11.getText();
                    
                String sqlUpdate = "Update Bill set Cust_Name='"+(field3)+"',Subscr_Type='"+(field4)+"',amount='"+(field5)+"' Where Cust_Id='"+(field1)+"'";
                      
                    stmt.executeUpdate(sqlUpdate);
          
                JOptionPane.showMessageDialog(null,"Table Bill Updated");
                    jTextField9.setText("");
                    jTextField3.setText("");
                    jTextField11.setText("");
                   
                           
        } 
            if(e.getSource()==jButton8){
        
                String field1 = jTextField1.getText();
               
         
                String field3=jTextField3.getText();
                String field4=jTextField6.getText();
                String field7= jTextField7.getText();
                String field8= jTextField8.getText();
              
                    
                String sqlUpdate = "Update Routes set Route_Name='"+(field3)+"',Route_descr='"+(field4)
                        +"',Route_Address='"+(field7)+"',Surbab='"+(field8)+"' Where Route_Num='"+(field1)+"'";
                      
                      stmt.executeUpdate(sqlUpdate);
          
                JOptionPane.showMessageDialog(null,"Table Routes Updated");
                    jTextField3.setText("");
                    jTextField6.setText("");
                    jTextField7.setText("");
                    jTextField8.setText("");
                           
        } 
        if(e.getSource()==jButton6){
        
                String field1 = jTextField1.getText();
               
         
                String field3=jTextField3.getText();
      
                String sqlUpdate = "Update Suppliers set Supp_Name='"+(field3)+"',Supp_Date='"+new Date()+"' Where Supp_Name='"+(field1)+"'";
                      
                      stmt.executeUpdate(sqlUpdate);
          
                JOptionPane.showMessageDialog(null,"Table Suppliers Updated");
                    jTextField9.setText("");
                    jTextField10.setText("");
                   
                           
        }       
       }
        catch(Exception exa){
            System.out.println("");
        }
            }
            catch(SQLException ex){
                System.out.println("");
            }
            
            
            finally{
                
                try{
                    if(resultSet!=null){
                    resultSet.close();
                    }
                    if(stmt!=null)
                    {stmt.close();}
                    if(conn!=null){
                    conn.close();}
                  
                }catch(Exception exception){
                    System.out.println("Something went wrong along the way");
                }
                  }
    }
}
